//app.js
import { WeToast } from './components/wetoast/wetoast.js'

var api = require('./config/api.js');
var user = require('./utils/user.js');

App({
  WeToast,
  onLaunch() {
    // 进入小程序时验证登录
  },
  onShow: function (options) {
    user.checkLogin().then(res => {
      this.globalData.hasLogin = true;
      // 用token登录
    }).catch(() => {
      this.globalData.hasLogin = false;
      wx.navigateTo({
        url: '/pages/auth/auth_login/auth_login',
      })
    });
  },
  globalData: {
    userInfo: null,
    hasLogin: false,
  }
})